//
//  KnowledgeViewController.m
//  FoodFamily
//
//  Created by dlios on 15-6-20.
//  Copyright (c) 2015年 guoBang. All rights reserved.
//

#import "KnowledgeViewController.h"

@interface KnowledgeViewController ()

@end

@implementation KnowledgeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    UIImageView *imageview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 1000)];
    imageview.image = [UIImage imageNamed:@"beijing.png"];
    [self.view addSubview:imageview];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"相关常识";
     self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"iconfont-fanhui.png"] style:UIBarButtonItemStylePlain target:self action:@selector(qwer)];
    self.navigationItem.leftBarButtonItem.tintColor = [UIColor blackColor];
    [self AFNget];
    
}
-(void)AFNget
{
    self.knowdic = [NSMutableDictionary dictionary];
    NSString *string = [NSString stringWithFormat:@"http://121.41.88.194:80/HandheldKitchen/api/vegetable/tblvegetable!getIntelligentChoice.do?vegetable_id=%@&type=4&phonetype=0&is_traditional=0",self.movie.vegetable_id];
  //  NSLog(@"self.movie.vegetable_id ==%@",self.movie.vegetable_id);
[AFNGetDataValue getDataAFN:string block:^(NSMutableDictionary *dataDic) {
    //NSLog(@"%@",dataDic);
    NSMutableArray *array = [dataDic objectForKey:@"data"];
    for (NSMutableDictionary *dic in array) {
        self.movie = [[Movie alloc]init];
        self.movie.nutritionAnalysis = [dic objectForKey:@"nutritionAnalysis"];
        self.movie.productionDirection = [dic objectForKey:@"productionDirection"];
        self.movie.imagePath1 = [dic objectForKey:@"imagePath"];
       
        [self.knowdic objectForKey:self.movie];
        //NSLog(@"%@",self.movie.nutritionAnalysis);
    }
    KnowView *knowview = [[KnowView alloc]initWithFrame:[[UIScreen mainScreen]bounds]and:self.movie];
    //NSLog(@"self.movie.nutritionAnalysis = %@",self.movie.nutritionAnalysis);
    [self.view addSubview:knowview];
}];

}
-(void)qwer
{

    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
